%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Time evolution of a simple matrix.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;

H =[ 0 .7																	%Hamiltonian ( hbar=1 )
	 .7 1 ];

psi0=[ 1																	%initial state
	   0 ];

t=[0:.02:5];																%time

for tt=1:length(t)
	psi=expm(-1i*H*t(tt))*psi0;												%solution of Schrödinger equation
	Psi1(tt)=psi(1);
	Psi2(tt)=psi(2);
end

figure(1);		clf;
subplot(221),plot(t,abs(Psi1).^2,'r',t,abs(Psi2).^2,'+g')
set(gca,'xLim',[0 5],'yLim',[0 1],'FontSize',16)
xlabel('\fontsize{16}{\itt}   (s)')
ylabel('\fontsize{16}|1\rangle , |2\rangle')

		